package com.qf.controller;

import com.qf.annotation.ProccessInfo;
import com.qf.entity.Address;
import com.qf.entity.Orders;
import com.qf.exception.BizException;
import com.qf.exception.ControllerException;
import com.qf.service.AddressService;
import com.qf.service.OrdersService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin("*")
@RestController
@RequestMapping("/orders")
public class OrdersShowController {


    private OrdersService ordersService;

    public OrdersShowController(OrdersService ordersService) {
        this.ordersService = ordersService;
    }

        @ProccessInfo(value = "购物车信息", requireParamInfo = true)
        @GetMapping("/getById")//..../orders/getById?oUserId=28&oStatus=0
        public Object queryById(int oUserId,int oStatus) {
            List<Orders> list=null;
            Orders orders = null;
            try {
//            String st = null;
//            st.startsWith("abc");
                list = ordersService.queryById(oUserId,oStatus);
                System.out.println(list);
            } catch (BizException e) {
                throw e;
            } catch (Exception ex) {
                throw new ControllerException("控制层异常: " + ex.getMessage());
            }
            return list;
        }

    }

